<?php
/**
 * Created by PhpStorm.
 * User: zhao shou qiang
 * Date: 2017/12/27 0027
 * Time: 13:16
 */


use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
use backend\controllers\DtActionFilter;

$step2 = false;
if ($investigation->lawsuit != '' || $investigation->execution != '' || $investigation->auction !='')
    $step2 = true;

$step3 = false;
if ($investigation->records_investigation != '' || $investigation->records_consistence != '' || $investigation->order_sent !='' ||
    $investigation->court_summons !='' || $investigation->execution_method !='' || $investigation->layer_interview!= '')
    $step3 = true;

$step4 = false;
if ($investigation->debt_collection != '' || $investigation->prescription != '' || $investigation->origin_files !='')
    $step4 = true;

$display_state = false;
if (DtActionFilter::checkProject('project_edit', $projectId)) {
    $display_state = true;
}

?>

<div class="zhaiQuanQingKuang" id="zhaiQuan">
    <div class="container containerShadow">
        <div class="row">
            <div class="topimg">
                <div class="left pull-left">
                    <span>债权基本情况</span>
                </div>
                <div class="pull-right">
                    <a href="###">
                        <?php
                        if ($display_state)
                            echo Html::img('@web/image/projectDetails/edit.png', ['class' => 'editImg']);
                        ?>
                    </a>
                </div>
            </div>

            <form action="">
                <table border="1" cellspacing="0" cellpadding="0" class="investigation_step1">
                    <tr>
                        <td>借款人名称</td>
                        <td>
                            <input type="text" name="ProjectInvestigation['borrower']"
                                   value="<?php echo Html::encode($investigation->borrower); ?>"
                                   class="borrower"
                                   readonly="readonly" style="width: 100%; padding: 0px;"/>
                        </td>
                        <td>保证人名称</td>
                        <td>
                            <input type="text" name="ProjectInvestigation['guarantor']"
                                   value="<?php echo Html::encode($investigation->guarantor); ?>"
                                   class="guarantor"
                                   readonly="readonly" style="width: 100%; padding: 0px;"/>
                        </td>
                    </tr>
                    <tr>
                        <td>抵押人名称</td>
                        <td>
                            <input type="text" name="ProjectInvestigation['mortgagor']"
                                   value="<?php echo Html::encode($investigation->mortgagor); ?>"
                                   class="mortgagor"
                                   readonly="readonly" style="width: 100%; padding: 0px;"/>
                        </td>
                        <td>抵押物类型</td>
                        <td>
                            <?php
                            $InvestigationMortgageType = Yii::$app->params['InvestigationMortgageType'];
                            $mortgage_type = '';
                            if($investigation->mortgage_type != '') {
                                $mortgage_type_array = explode(',', $investigation->mortgage_type);
                                $mortgage_type_data = array();
                                foreach ($mortgage_type_array as $value) {
                                    $mortgage_type_data[] = $InvestigationMortgageType[$value];
                                }
                                $mortgage_type =  join('、', $mortgage_type_data);
                            }
                            ?>
                            <input type="text" name="ProjectInvestigation['mortgage_type']"
                                   value="<?php echo Html::encode($mortgage_type); ?>"
                                   class="mortgage_type"
                                   readonly="readonly" style="width: 100%; padding: 0px;"/>
                        </td>
                    </tr>
                    <tr>
                        <td>本 金（元）</td>
                        <td>
                            <input type="text" name="ProjectInvestigation['principal']"
                                   value="<?php echo Html::encode($investigation->principal); ?>"
                                   class="principal"
                                   readonly="readonly" style="width: 100%; padding: 0px;"/>
                        </td>
                        <td>利 息（元）</td>
                        <td>
                            <input type="text" name="ProjectInvestigation['interest']"
                                   value="<?php echo Html::encode($investigation->interest); ?>"
                                   class="interest"
                                   readonly="readonly" style="width: 100%; padding: 0px;"/>
                        </td>
                    </tr>
                </table>
            </form>

            <form action="" id="zhai-quan" name="investigation_step1" class="zhaiQuanEdit zhaiQuan borderColor" style="display: none;">
                <table class="table4" border="1" cellspacing="0" cellpadding="0">
                    <tr>
                        <td>借款人名称</td>
                        <td>
                            <!--<input autofocus type="text"/>-->
                            <input type="text" id="projectinvestigation-borrower"
                                   name="ProjectInvestigation[borrower]"
                                   value="<?php echo Html::encode($investigation->borrower); ?>" maxlength="255"
                                   placeholder="请输入借款人名称"
                                   aria-required="true" aria-invalid="true">
                        </td>
                        <td>保证人名称</td>
                        <td>
                            <input type="text" id="projectinvestigation-guarantor"
                                   name="ProjectInvestigation[guarantor]"
                                   value="<?php echo Html::encode($investigation->guarantor); ?>" maxlength="255"
                                   placeholder="请输入保证人名称"
                                   aria-required="true" aria-invalid="true">
                        </td>
                    </tr>
                    <tr>
                        <td>抵押人名称</td>
                        <td>
                            <input type="text" id="projectinvestigation-mortgagor"
                                   name="ProjectInvestigation[mortgagor]"
                                   value="<?php echo Html::encode($investigation->mortgagor); ?>" maxlength="255"
                                   placeholder="请输入抵押人名称"
                                   aria-required="true" aria-invalid="true">
                        </td>
                        <td>抵押物类型</td>
                        <td style="width: 424px!important;">
                            <select type='select' class="select" id="select1" multiple="multiple">
                        </td>
                    </tr>
                    <tr>
                        <td>本 金（元）</td>
                        <td class="yz">
                            <input type="text" id="projectinvestigation-principal" isNumber='true' onkeyup='true'
                                   name="ProjectInvestigation[principal]"
                                   value="<?php echo Html::encode($investigation->principal); ?>" maxlength="255"
                                   placeholder="请输入本金">
                        </td>
                        <td>利 息（元）</td>
                        <td class="yz">
                            <input type="text" id="projectinvestigation-interest" isNumber='true' onkeyup='true'
                                   name="ProjectInvestigation[interest]"
                                   value="<?php echo Html::encode($investigation->interest); ?>" maxlength="255"
                                   placeholder="请输入利息">
                        </td>
                    </tr>
                </table>
                <div class="cancelInConfirm clearfix">
                    <input class="cancelInConfirmActive investigation_step1_confirm" type="button" value="保存"/>
                    <input class="investigation_step1_cancel" type="button" value="取消"/>

                    <input type="hidden" id="investigation_id1" name="id" value="<?php echo $investigation->id; ?>"/>
                    <input type="hidden" id="investigation_mortage_type" name="ProjectInvestigation[mortgage_type]"
                           value="<?php echo Html::encode($investigation->mortgage_type); ?>"/>
                    <input type="hidden" name="ProjectInvestigation[project_id]" value="<?php echo $projectId; ?>"/>
                    <input type="hidden" id="investigation_url"
                           value="<?php echo Url::toRoute('project-investigation/save-investigation', true) ?>"/>

                    <input type="hidden" id="cancel_investigation_url"
                           value="<?php echo Url::toRoute('project-investigation/cancel-investigation', true) ?>"/>
                </div>
            </form>

            <div class="centerText clearfix">
                <span class="pull-left">司法进展
                    <span class="step2_nothing"><?php if(!$step2) echo '（暂无数据）'; ?></span>
                </span>
                <div>
                    <a href="###" class="pull-right">
                        <?php
                        if ($display_state)
                            echo Html::img('@web/image/projectDetails/edit.png', ['class' => 'editImg']);
                        ?>
                    </a>
                </div>
            </div>

            <form action="" style="display: <?php if(!$step2) echo 'none'; else echo 'block';?>;">
                <table class="top30 textAuto">
                    <tr>
                        <td>
                            诉讼情况
                        </td>
                        <td>
                        	<pre class="lawsuit-pre"><?php echo Html::encode($investigation->lawsuit); ?></pre>
                            <!--<textarea name="ProjectInvestigation[lawsuit]" readonly
                                      class="lawsuit-pre" rows=""
                                      cols="" style="border:0px solid red!important"><?php echo Html::encode($investigation->lawsuit); ?></textarea>-->
                        </td>
                    </tr>
                    <tr>
                        <td>
                            执行情况
                        </td>
                        <td>
                        	<pre class="execution-pre"><?php echo Html::encode($investigation->execution); ?></pre>
                            <!--<div>
                                <textarea name="ProjectInvestigation[execution]" readonly
                                          class="execution" rows=""
                                          cols=""style="border:0px solid red!important"><?php echo Html::encode($investigation->execution); ?></textarea>
                            </div>-->
                        </td>
                    </tr>
                    <tr>
                        <td>
                            评估、拍卖情况
                        </td>
                        <td>
                        	<pre  class="auction-pre"><?php echo Html::encode($investigation->auction); ?></pre>
                            <!--<textarea name="ProjectInvestigation[auction]" readonly
                                      class="auction" rows=""
                                      cols=""style="border:0px solid red!important"><?php echo Html::encode($investigation->auction); ?></textarea>-->
                            <!--<div>
                                <?php /*if ($investigation->auction == '') { */?>
                                <?php /*} else {
                                    echo Html::encode($investigation->auction);
                                } */?>
                            </div>-->
                        </td>
                    </tr>
                </table>
            </form>

            <form action="" class="zhaiQuanEdit" name="investigation_step2" style="display: none">
                <table class="table2">
                    <tr>
                        <td>
                            诉讼情况
                        </td>
                        <td>
                            <textarea name="ProjectInvestigation[lawsuit]" class="textarea-edit2" rows="" cols=""
                            ><?php echo Html::encode($investigation->lawsuit); ?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            执行情况
                        </td>
                        <td>
                            <textarea name="ProjectInvestigation[execution]" class="textarea-edit2" rows="" cols=""
                            ><?php echo Html::encode($investigation->execution); ?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            评估、拍卖情况
                        </td>
                        <td>
                            <textarea name="ProjectInvestigation[auction]" class="textarea-edit2" rows="" cols=""
                            ><?php echo Html::encode($investigation->auction); ?></textarea>
                        </td>
                    </tr>
                </table>
                <div class="cancelInConfirm clearfix">
                    <input class="cancelInConfirmActive investigation_step2_confirm" type="button" value="保存"/>
                    <input class="investigation_step2_cancel" type="button" value="取消"/>
                    <input type="hidden" class="step2_state" value="<?php if($step2) echo 1; else echo 2;?>"/>
                    <input type="hidden" id="investigation_id2" name="id" value="<?php echo $investigation->id; ?>"/>
                    <input type="hidden" name="ProjectInvestigation[project_id]" value="<?php echo $projectId; ?>"/>
                </div>
            </form>

            <div class="centerText clearfix">
                <span class="pull-left">本案诉讼情况
                    <span class="step3_nothing"><?php if(!$step3) echo '（暂无数据）'; ?></span>
                </span>
                <div>
                    <a href="###" class="pull-right">
                        <?php
                        if ($display_state)
                            echo Html::img('@web/image/projectDetails/edit.png', ['class' => 'editImg']);
                        ?>
                    </a>
                </div>
            </div>

            <form action="" style="display: <?php if(!$step3) echo 'none'; else echo 'block';?>;">
                <table class="top30" border="" cellspacing="" cellpadding="">
                    <tr>
                        <td>案卷查询情况</td>
                        
                        <td>
                        	<pre  class="records_investigation-pre"><?php echo Html::encode($investigation->records_investigation); ?></pre>
                            <!--<div>
                                <textarea name="ProjectInvestigation[records_investigation]" readonly
                                          class="records_investigation" rows=""
                                          cols=""style="border:0px solid red!important"><?php echo Html::encode($investigation->records_investigation); ?></textarea>
                            </div>-->
                        </td>
                    </tr>
                    <tr>
                        <td>案卷是否一致</td>
                        <td>
                            <div>
                            	<pre class="records_consistence" name="ProjectInvestigation[records_consistence]"><?php echo Html::encode($investigation->records_consistence); ?></pre>
                            <!--	<input type="text" class="records_consistence" name="ProjectInvestigation[records_consistence]" value="<?php echo Html::encode($investigation->records_consistence); ?>" />-->
                                <!--<textarea name="ProjectInvestigation[records_consistence]" readonly
                                          class="records_consistence" rows=""
                                          cols=""style="border:0px solid red!important"><?php echo Html::encode($investigation->records_consistence); ?></textarea>-->
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 64px;">调解书/支付令 是否送达
                        </td>
                        <td>
                        	
                            <div>
                            	<pre name="ProjectInvestigation[order_sent]" 
                                          class="order_sent"><?php echo Html::encode($investigation->order_sent); ?></pre>
                                <!--<textarea  name="ProjectInvestigation[order_sent]" readonly
                                          class="order_sent" rows=""
                                          cols=""style="padding-left: 0px!important;border:0px solid red!important" ><?php echo Html::encode($investigation->order_sent); ?></textarea>-->
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 64px;">
                            开庭传票<br/> 是否送达
                        </td>
                        <td>
                        	<!--<pre class="court_summons" name="ProjectInvestigation[court_summons]"><?php echo Html::encode($investigation->court_summons); ?></pre>-->
                            <div>
                            	<pre name="ProjectInvestigation[court_summons]" 
                                          class="court_summons"><?php echo Html::encode($investigation->court_summons); ?></pre>
                                <!--<textarea name="ProjectInvestigation[court_summons]" readonly
                                          class="court_summons" rows=""
                                          cols=""style="border:0px solid red!important;padding-left: 0px!important;"><?php echo Html::encode($investigation->court_summons); ?></textarea>-->
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>执行终结方式</td>
                        <td>
                            <div>
                            	<pre class="execution_method-pre"><?php echo Html::encode($investigation->execution_method); ?></pre>
                                <!--<textarea name="ProjectInvestigation[execution_method]" readonly
                                          class="execution_method" rows=""
                                          cols=""style="border:0px solid red!important"><?php echo Html::encode($investigation->execution_method); ?></textarea>-->
                            </div>
                        </td>
                    </tr>		
                    <tr>
                        <td>法官/律师访谈</td>
                        <td>
                        	<pre  class="layer_interview-pre"><?php echo Html::encode($investigation->layer_interview); ?></pre>
                            <!--<div>
                                <textarea name="ProjectInvestigation[layer_interview]" readonly
                                          class="layer_interview" rows=""
                                          cols=""style="border:0px solid red!important"><?php echo Html::encode($investigation->layer_interview); ?></textarea>
                            </div>-->
                        </td>
                    </tr>
                </table>
            </form>

            <form action="" name="investigation_step3" class="zhaiQuanEdit" style="display: none">
                <table class="table2 benAnSuSongQingKuang" border="" cellspacing="" cellpadding="">
                    <tr>
                        <td>案卷查询情况</td>
                        <td>
                            <textarea class="two textarea-edit2" name="ProjectInvestigation[records_investigation]"
                                      rows="" cols=""
                                      placeholder=""><?php echo Html::encode($investigation->records_investigation); ?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>案卷是否一致</td>
                        <td>
                            <textarea class="two textarea-edit2" class="textarea-edit2" name="ProjectInvestigation[records_consistence]" rows="" cols=""
                                      placeholder="本案诉与剥离卷中的裁判文书内容是否一致？"
                            ><?php echo Html::encode($investigation->records_consistence); ?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>调解书/支付令<br/>是否送达
                        </td>
                        <td>
                            <textarea class="two textarea-edit2"   name="ProjectInvestigation[order_sent]" rows="" cols=""
                                      placeholder="调解书、支付令是否送达被告？"
                            ><?php echo Html::encode($investigation->order_sent); ?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            开庭传票<br/> 是否送达
                        </td>
                        <td>
                            <textarea class="two textarea-edit2"  name="ProjectInvestigation[court_summons]" rows="" cols=""
                                      placeholder="被告缺席判决的，是否送达开庭传票，送达方式是什么？"
                            ><?php echo Html::encode($investigation->court_summons); ?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>执行终结方式</td>
                        <td>
                            <textarea class="textarea-edit2"  name="ProjectInvestigation[execution_method]" rows="" cols=""
                                      placeholder="执行终结的方式是什么？执行人申请撤回、法院主动终结、执行和解或履行完毕？"
                            ><?php echo Html::encode($investigation->execution_method); ?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>法官/律师访谈</td>
                        <td>
                            <textarea class="textarea-edit2"  name="ProjectInvestigation[layer_interview]" rows="" cols=""
                                      placeholder="经办法官、律师访谈情况"
                            ><?php echo Html::encode($investigation->layer_interview); ?></textarea>
                        </td>
                    </tr>
                </table>
                <div class="cancelInConfirm clearfix">
                    <input class="cancelInConfirmActive investigation_step3_confirm" type="button" value="保存"/>
                    <input class="investigation_step3_cancel" type="button" value="取消"/>

                    <input type="hidden" id="investigation_id3" name="id" value="<?php echo $investigation->id; ?>"/>
                    <input type="hidden" class="step3_state" value="<?php if($step3) echo 1; else echo 2;?>"/>
                    <input type="hidden" name="ProjectInvestigation[project_id]" value="<?php echo $projectId; ?>"/>
                </div>
            </form>

            <div class="centerText clearfix">
                <span class="pull-left">未诉时效
                    <span class="step4_nothing"><?php if(!$step4) echo '（暂无数据）'; ?>
                    </span>
                </span>
                <div>
                    <a href="###" class="pull-right">
                        <?php
                        if ($display_state)
                            echo Html::img('@web/image/projectDetails/edit.png', ['class' => 'editImg']);
                        ?>
                    </a>
                </div>
            </div>

            <form action="" style="display: <?php if(!$step4) echo 'none'; else echo 'block';?>;">
                <table class="top30">
                    <tr>
                        <td>
                            未诉债权<br/>催收情况
                        </td>
                        <td style="height: 64px;">
                        	<pre  class="debt_collection-pre"><?php echo Html::encode($investigation->debt_collection); ?></pre>
                            <!--<div>
                                <textarea name="ProjectInvestigation[debt_collection]" readonly
                                          class="debt_collection" rows=""
                                          cols=""style="border:0px solid red!important"><?php echo Html::encode($investigation->debt_collection); ?></textarea>
                            </div>-->
                        </td>
                    </tr>
                    <tr>
                        <td>时效结论</td>
                        <td>
                        	<pre  class="prescription-pre" ><?php echo Html::encode($investigation->prescription); ?></pre>
                            <!--<div>
                                <textarea name="ProjectInvestigation[prescription]" readonly
                                          class="prescription" rows=""
                                          cols=""style="border:0px solid red!important"><?php echo Html::encode($investigation->prescription); ?></textarea>
                            </div>-->
                        </td>
                    </tr>
                    <tr>
                        <td>证据是否有原件</td>
                        <td>
                        	<pre class="origin_files-pre"><?php echo Html::encode($investigation->origin_files);?></pre>
                            <!--<div>
                                <textarea name="ProjectInvestigation[origin_files]" readonly
                                          class="origin_files" rows=""
                                          cols=""style="border:0px solid red!important"><?php echo Html::encode($investigation->origin_files); ?></textarea>
                            </div>-->
                        </td>
                    </tr>
                </table>
            </form>

            <form action="" name="investigation_step4" class="zhaiQuanEdit" style="display: none;">
                <table class="table2">
                    <tr>
                        <td>
                            未诉债权<br/>催收情况
                        </td>
                        <td>
                            <textarea class="textarea-edit2" name="ProjectInvestigation[debt_collection]" rows="" cols=""><?php
                                if ($investigation->debt_collection == '') {
                                    echo '';
                                } else {
                                    echo Html::encode($investigation->debt_collection);
                                }
                                ?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>时效结论</td>
                        <td>
                            <textarea  class="textarea-edit2" name="ProjectInvestigation[prescription]" rows="" cols=""><?php echo Html::encode($investigation->prescription); ?></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>证据是否有原件</td>
                        <td>
                            <textarea  class="textarea-edit2" name="ProjectInvestigation[origin_files]" rows="" cols=""><?php echo Html::encode($investigation->origin_files); ?></textarea>
                        </td>
                    </tr>
                </table>
                <div class="cancelInConfirm clearfix">
                    <input class="cancelInConfirmActive investigation_step4_confirm" type="button" value="保存"/>
                    <input class="investigation_step4_cancel" type="button" value="取消"/>
                    <input type="hidden" id="investigation_id4" name="id" value="<?php echo $investigation->id; ?>"/>
                    <input type="hidden" class="step4_state" value="<?php if($step4) echo 1; else echo 2;?>"/>
                    <input type="hidden" name="ProjectInvestigation[project_id]" value="<?php echo $projectId; ?>"/>
                </div>
            </form>
        </div>
    </div>
</div>


<!-- textarea 高度设置对比div -->
	
<div style="max-height: 1px; overflow: hidden;">
	<div id="d1" style="visibility:hidden;min-height: 80px;"></div>
</div>
